package org.yxt.springcloud.handler;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.yxt.springcloud.entities.CommonResult;

/**
 * 自定义sentinel限流处理业务类 注意方法必须是static
 *
 * @author yxt
 * @date 2022-01-19
 */
public class MySentinelHandler {

    /**
     * 可以针对不同的handler
     *
     * @param exception
     * @return
     */
    public static CommonResult blockHandler2Qps(BlockException exception) {
        return new CommonResult(0, "限流启动-qps");
    }

    /**
     * 可以针对不同的handler
     *
     * @param exception
     * @return
     */
    public static CommonResult blockHandler2HotKey(BlockException exception) {
        return new CommonResult(0, "限流启动-hotKey");
    }
}
